//
//  KKLoginHttp.m
//  DoMi
//
//  Created by 康凯 on 16/10/27.
//  Copyright © 2016年 kk. All rights reserved.
//

#import "KKLoginHttp.h"

@implementation KKLoginHttp

//获取验证码
+(void)getCode:(NSDictionary *)params success:(void (^)(id))success failure:(void (^)(NSError *))failure{
    
    [KKBaseHttp Post:GET_CODE params:params success:^(id responseObject) {
        NSString *code=[responseObject objectForKey:@"code"];
        if([code isEqualToString:@"ok"]){
            success(responseObject);
        }else{
            NSString *msg=[responseObject objectForKey:@"code"];
            [self toast:msg];
        }
    } failure:^(NSError *error) {

    }];
}
//登录
+(void)login:(NSDictionary *)params success:(void (^)(id))success failure:(void (^)(NSError *))failure{
    [KKBaseHttp Post:LOGIN params:params success:^(id responseObject) {
        NSString *code=[responseObject objectForKey:@"code"];
        if([code isEqualToString:@"ok"]){
            success(responseObject);
        }else{
            NSString *msg=[responseObject objectForKey:@"code"];
            [self toast:msg];
        }
    } failure:^(NSError *error) {
        
    }];
}
@end
